package com.a.basis;
//输入6次成绩，去掉最大值、最小值，求其平均值
import java.util.Scanner;

public class TestJudges {
    public static void main(String[] args) {
        int[] nums=new int[6];
        Scanner scanner=new Scanner(System.in);
        System.out.println("请输入分数：");
        int a=0;
        int Max,Min,avg;
        int sum=0;
        for (int i = 0; i < 6; i++) {
            nums[i]=scanner.nextInt();
        }
        for (int i = 0; i < nums.length-1; i++) {
            if (nums[a]>nums[i+1]){//a大于其他值就更换，所以a为最小值
                int temp=nums[a];
                nums[a]=nums[i+1];
                nums[i+1]=temp;
            }
        }
        Min=nums[a];
        System.out.println("最小值："+Min);
        for (int i = 0; i < nums.length-1; i++) {
            if (nums[a]<nums[i+1]){
                int temp=nums[a];
                nums[a]=nums[i+1];
                nums[i+1]=temp;
            }
        }
        Max=nums[a];
        System.out.println("最大值："+Max);
        for (int i = 0; i < nums.length; i++) {
            sum+=nums[i];
        }
        avg=(sum-Max-Min)/(nums.length-2);
        System.out.println("平均值："+avg);
    }
}
